import request from '@/utils/request'
import Qs from 'qs'

// 订单列表
export function listOrder(query) {
  return request({
    url: '/order-info/queryOrderInfoPage',
    method: 'get',
    params: query,
    paramsSerializer: {
      serialize: (params) => Qs.stringify(params, {
        arrayFormat: 'repeat'
      })
    }
  })
}

// 设置订单状态
export function setOrderStatus(data) {
  return request({
    url: '/order-info/setOrderStatus',
    method: 'post',
    data
  })
}

// 获取订单详情
export function detailOrder(orderId) {
  return request({
    url: '/order-info/getOrderInfoById',
    method: 'get',
    params: {
      orderId: orderId
    }
  })
}


// 删除订单
export function delOrderInfoById(query) {
  return request({
    url: '/order-info/delOrderInfoById',
    method: 'get',
    params: query
  })
}

export function shipOrder(data) {
  return request({
    url: '/order/ship',
    method: 'post',
    data
  })
}

export function replyComment(data) {
  return request({
    url: '/order/reply',
    method: 'post',
    data
  })
}
